package com.example.midautumn.controller;

import com.example.midautumn.bean.BaseData;
import com.example.midautumn.bean.TestControllerBean;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/hello")
public class TestController {

    @RequestMapping("/test")
    public BaseData<TestControllerBean> Test() {
        BaseData<TestControllerBean> bean = new BaseData<>();
        try {
            bean.setCode(200);
            bean.setMsg("请求成功");
            bean.setData(new TestControllerBean());
            bean.getData().setContent("hello i am you first code");
        } catch (Exception e) {
            bean.setCode(500);
            bean.setMsg("服务器代码异常");
        }
        return bean;

    }

    @RequestMapping("/test/t")
    public String Test1() {
        return "hello i am you first code";
    }
}
